package net.cyndeline.rldungeon.dgs

import scalax.collection.GraphEdge.UnDiEdge
import scalax.collection.immutable.Graph

/**
 * Used by parameters to parse a graph-representation of a map into a value representing the aspect of the map
 * that the parameter is interested in. Example: A parameter that is interested in the number of rooms (vertices)
 * in the graph has a ParameterEstimator that counts the number of vertices in the supplied graph and returns the
 * amount.
 */
trait ParameterEstimator[VType, EType[X] <: UnDiEdge[X]] {

  /**
   * Parse a graph into a numerical value.
   * @param graph Graph to parse.
   * @return a value representing some aspect of the graph.
   */
  def value(graph: Graph[VType, EType]): Double

}
